package mongo;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.ndp.fb.constant.MongoConstants;
import com.ndp.fb.model.CustomAudienceTemplateRoster;

/**
 * Created by infi.he on 2016/3/9.
 */
public class MongoTest1 {
    public static void main(String[] args) throws Exception {
        MongoClientURI connectionString = new MongoClientURI("mongodb://172.30.10.121:27017");
        MongoClient mongoClient = new MongoClient(connectionString);
        DB db = mongoClient.getDB("cstore-infi");
        DBCollection collection = db.getCollection(MongoConstants.TABLE_NAME_CUSTOM_AUDIENCE_TEMPLATE_ROSTER);
        for (int i = 0; i < 10; i++) {
            BasicDBObject doc = new BasicDBObject();
            doc.put("customAudienceTemplateId", 1);
            doc.put("type", 1);
            doc.put("value", i);
            collection.update(doc, doc, true, false);
        }
    }
}
